
/*  ************************************************************************  */
/*  File Name: Main_CODE.do                                                   */ 
/* 	Author:	Ray Ou-Yang				                                          */
/*  Last Update: July 4, 2025                                                 */   			     
/*	Purpose: Replication code for "Dividing Stakes: Economic Interdependence, */
/*           Natural Resources, and Conflict"                                 */
/*	************************************************************************  */


*******************************************************
/* Multiple Imputation and Interaction Term Creation */ 

use "Original_DATA.dta", replace

gen lncapability = ln(capability)
gen lndist = ln(dist)

mi set flong

mi register imputed tradetie low_exdytrade disregime

mi register regular midissyr maxfatal resource_sal intangible_sal recfat15 capability lncapability conttype dist lndist jointio issue region directed_id year
	
mi impute chained (pmm, knn(10)) tradetie low_exdytrade disregime = midissyr maxfatal resource_sal intangible_sal recfat15 capability lncapability conttype dist lndist jointio i.issue i.region i.directed_id i.year, add(15) dots force rseed(8888) replace 

mi passive: gen tradetie_rsal = tradetie * resource_sal
mi passive: gen tradetie_intsal = tradetie * intangible_sal
mi passive: gen tradetie_rsal_intsal = tradetie * resource_sal * intangible_sal
mi passive: gen tradetie_river = tradetie * riveriss
mi passive: gen tradetie_mar = tradetie * mariss
mi passive: gen exdytrade_rsal = low_exdytrade * resource_sal


********************************************************
/* Table 3: Average Issue Salience by ICOW Issue Type */

use "Original_DATA.dta", replace

foreach v of varlist resource_sal nrtangible_sal intangible_sal{

sum `v' if terriss == 1
sum `v' if riveriss == 1
sum `v' if mariss == 1

}


*****************************************************************
/* Table 4: Descriptive Statistics for All Variables (Imputed) */

use "Main_DATA.dta", replace

mi passive: gen capability_r = exp(lncapability)
mi passive: gen dist_r = exp(lndist)

misum midissyr maxfatal tradetie low_exdytrade resource_sal intangible_sal recfat15 capability_r conttype dist_r disregime jointio, format(%9.2f)


*******************************************************************
/* Table 5: Trade, Resource Salience, and Dispute Militarization */

use "Main_DATA.dta", replace

*** Model 1 ***
mi estimate, post: logit midissyr l.tradetie l.resource_sal l.tradetie_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, vce(robust)

*** Model 2 ***	 
mi estimate, cmdok post: tobit maxfatal l.tradetie l.resource_sal l.tradetie_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, ll(0) ul(6) vce(robust)

*** Model 3 ***	
mi estimate, post: logit midissyr l.low_exdytrade l.resource_sal l.exdytrade_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, vce(robust) 

*** Model 4 ***
mi estimate, cmdok post: tobit maxfatal l.low_exdytrade l.resource_sal l.exdytrade_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, ll(0) ul(6) vce(robust)

	 
************************************************************************************************
/* Table 6: Resource Salience vs. Intangible Salience in Shaping the Trade-Peace Relationship */	 

use "Main_DATA.dta", replace

*** Model 5 ***
mi estimate, post: logit midissyr l.tradetie l.resource_sal l.tradetie_rsal l.intangible_sal l.tradetie_intsal l.tradetie_rsal_intsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, vce(robust)

*** Model 6 ***
mi estimate, cmdok post: tobit maxfatal l.tradetie l.resource_sal l.tradetie_rsal l.intangible_sal l.tradetie_intsal l.tradetie_rsal_intsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, ll(0) ul(6) vce(robust)

*** Model 7 ***
mi estimate, post: logit midissyr l.tradetie riveriss mariss l.tradetie_river l.tradetie_mar l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio, vce(robust)

*** Model 8 ***
mi estimate, cmdok post: tobit maxfatal l.tradetie riveriss mariss l.tradetie_river l.tradetie_mar l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio, ll(0) ul(6) vce(robust)


*************************************************************
/* Table 7: Marginal Effects of Dyadic Trade by Issue Type */

use "Main_DATA.dta", replace

*** Model 7 Marginal Effects ***	 	 	 
mi estimate, post: logit midissyr l.tradetie riveriss mariss l.tradetie_river l.tradetie_mar l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio, vce(robust)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_river] *0 + _b[l.tradetie_mar] * 0)) atmeans level(90) cmdmargins cformat(%9.3f)
 
mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_river] *1 + _b[l.tradetie_mar] * 0)) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_river] *0 + _b[l.tradetie_mar] * 1)) atmeans level(90) cmdmargins cformat(%9.3f)   
 
*** Model 8 Marginal Effects ***	 	 	  
mi estimate, cmdok post: tobit maxfatal l.tradetie riveriss mariss l.tradetie_river l.tradetie_mar l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio, ll(0) ul(6) vce(robust)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_river] * 0 + _b[l.tradetie_mar] * 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_river] * 1 + _b[l.tradetie_mar] * 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_river] * 0 + _b[l.tradetie_mar] * 1) atmeans level(90) cmdmargins cformat(%9.3f)


************************************************************** 
/* Figure 1: Marginal Effects of Dyadic Trade (Computation) */ 	 

use "Main_DATA.dta", replace
	 
*** Model 1 Marginal Effects ***	
mi estimate, post: logit midissyr l.tradetie l.resource_sal l.tradetie_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, vce(robust)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal)) at(l.resource_sal = (0(1)2) riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)
 
mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal)) at(l.resource_sal = (0(1)7) riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal)) at(l.resource_sal = (0(1)8) riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)

*** Model 2 Marginal Effects ***	 	  
mi estimate, cmdok post: tobit maxfatal l.tradetie l.resource_sal l.tradetie_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, ll(0) ul(6) vce(robust)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] * l.resource_sal) at(l.resource_sal = (0(1)2) riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] * l.resource_sal) at(l.resource_sal = (0(1)7) riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] * l.resource_sal) at(l.resource_sal = (0(1)8) riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)
 
 
*********************************************************** 
/* Figure 1: Marginal Effects of Dyadic Trade (Graphing) */ 	

use "Graphing_DATA.dta", replace

*** Model 1 - Territorial Issues ***	 
twoway rarea l90 u90 resource_sal if model == 1 & issue_type == "terriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 1 & issue_type == "terriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((a) Territorial Issues, size(medium)) 

*** Model 1 - River Issues ***
twoway rarea l90 u90 resource_sal if model == 1 & issue_type == "riveriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 1 & issue_type == "riveriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((b) River Issues, size(medium)) 

*** Model 1 - Maritime Issues ***
twoway rarea l90 u90 resource_sal if model == 1 & issue_type == "mariss", color(gs14) lwidth(none) || line dydx resource_sal if model == 1 & issue_type == "mariss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((c) Maritime Issues, size(medium))

*** Model 2 - Territorial Issues ***	 
twoway rarea l90 u90 resource_sal if model == 2 & issue_type == "terriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 2 & issue_type == "terriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((a) Territorial Issues, size(medium))

*** Model 2 - River Issues ***
twoway rarea l90 u90 resource_sal if model == 2 & issue_type == "riveriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 2 & issue_type == "riveriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((b) River Issues, size(medium))

*** Model 2 - Maritime Issues ***
twoway rarea l90 u90 resource_sal if model == 2 & issue_type == "mariss", color(gs14) lwidth(none) || line dydx resource_sal if model == 2 & issue_type == "mariss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((c) Maritime Issues, size(medium))


*******************************************************************
/* Figure 2: Marginal Effects of Extradyadic Trade (Computation) */

use "Main_DATA.dta", replace

*** Model 3 Marginal Effects ***	
mi estimate, post: logit midissyr l.low_exdytrade l.resource_sal l.exdytrade_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, vce(robust)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.low_exdytrade] + _b[l.exdytrade_rsal] * l.resource_sal)) at(l.resource_sal = (0(1)2) riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)
 
mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.low_exdytrade] + _b[l.exdytrade_rsal] * l.resource_sal)) at(l.resource_sal = (0(1)7) riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.low_exdytrade] + _b[l.exdytrade_rsal] * l.resource_sal)) at(l.resource_sal = (0(1)8) riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)

*** Model 4 Marginal Effects ***	
mi estimate, cmdok post: tobit maxfatal l.low_exdytrade l.resource_sal l.exdytrade_rsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, ll(0) ul(6) vce(robust)	

mimrgns, expression(_b[l.low_exdytrade] + _b[l.exdytrade_rsal] * l.resource_sal) at(l.resource_sal = (0(1)2) riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.low_exdytrade] + _b[l.exdytrade_rsal] * l.resource_sal) at(l.resource_sal = (0(1)7) riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.low_exdytrade] + _b[l.exdytrade_rsal] * l.resource_sal) at(l.resource_sal = (0(1)8) riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)

	  
****************************************************************
/* Figure 2: Marginal Effects of Extradyadic Trade (Graphing) */

use "Graphing_DATA.dta", replace

*** Model 3 - Territorial Issues ***	 
twoway rarea l90 u90 resource_sal if model == 3 & issue_type == "terriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 3 & issue_type == "terriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Extradyadic Trade") xtitle("Resource Salience") title((a) Territorial Issues, size(medium))

*** Model 3 - River Issues ***
twoway rarea l90 u90 resource_sal if model == 3 & issue_type == "riveriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 3 & issue_type == "riveriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Extradyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((b) River Issues, size(medium)) 

*** Model 3 - Maritime Issues ***
twoway rarea l90 u90 resource_sal if model == 3 & issue_type == "mariss", color(gs14) lwidth(none) || line dydx resource_sal if model == 3 & issue_type == "mariss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Extradyadic Trade") xtitle("Resource Salience") title((c) Maritime Issues, size(medium))

*** Model 4 - Territorial Issues ***	 
twoway rarea l90 u90 resource_sal if model == 4 & issue_type == "terriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 4 & issue_type == "terriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Extradyadic Trade") xtitle("Resource Salience") title((a) Territorial Issues, size(medium)) 

*** Model 4 - River Issues ***
twoway rarea l90 u90 resource_sal if model == 4 & issue_type == "riveriss", color(gs14) lwidth(none) || line dydx resource_sal if model == 4 & issue_type == "riveriss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Extradyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((b) River Issues, size(medium)) 

*** Model 4 - Maritime Issues ***
twoway rarea l90 u90 resource_sal if model == 4 & issue_type == "mariss", color(gs14) lwidth(none) || line dydx resource_sal if model == 4 & issue_type == "mariss" , lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Extradyadic Trade") xtitle("Resource Salience") title((c) Maritime Issues, size(medium)) 


*********************************************************************
/* Figure 3: Marginal Effects of Dyadic Trade on MID Onset         */ 
/* Varying Resource Salience and Intangible Salience (Computation) */

use "Main_DATA.dta", replace

*** Model 5 Marginal Effects ***
mi estimate, post: logit midissyr l.tradetie l.resource_sal l.tradetie_rsal l.intangible_sal l.tradetie_intsal l.tradetie_rsal_intsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, vce(robust)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)2) l.intangible_sal = 0 riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)2) l.intangible_sal = 3.100463 riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)2) l.intangible_sal = 6 riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)7) l.intangible_sal = 1 riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)7) l.intangible_sal = 1.965924 riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)7) l.intangible_sal = 2 riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)8) l.intangible_sal = 0 riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)8) l.intangible_sal = 1.361748 riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(invlogit(predict(xb)) * (1 - invlogit(predict(xb))) * (_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal)) at(l.resource_sal = (0(1)8) l.intangible_sal = 2 riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f)


******************************************************************
/* Figure 3: Marginal Effects of Dyadic Trade on MID Onset      */ 
/* Varying Resource Salience and Intangible Salience (Graphing) */

use "Graphing_DATA.dta", replace

*** Territorial Issues ***	 
twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "terriss" & intangible_sal == 0, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "terriss" & intangible_sal == 0, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((a) Lowest Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "terriss" & intangible_sal == 3.100463, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "terriss" & intangible_sal == 3.100463, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((b) Average Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "terriss" & intangible_sal == 6, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "terriss" & intangible_sal == 6, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((c) Highest Intangible Salience, size(medium)) 

*** River Issues ***
twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "riveriss" & intangible_sal == 1, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "riveriss" & intangible_sal == 1, lcolor(gs6)lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((a) Lowest Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "riveriss" & intangible_sal == 1.965924, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "riveriss" & intangible_sal == 1.965924, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((b) Average Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "riveriss" & intangible_sal == 2, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "riveriss" & intangible_sal == 2, lcolor(gs6)lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((c) Highest Intangible Salience, size(medium)) 

*** Maritime Issues ***
twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "mariss" & intangible_sal == 0, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "mariss" & intangible_sal == 0, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((a) Lowest Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "mariss" & intangible_sal == 1.361748, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "mariss" & intangible_sal == 1.361748, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((b) Average Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 5 & issue_type == "mariss" & intangible_sal == 2, color(gs14) lwidth(none) || line dydx resource_sal if model == 5 & issue_type == "mariss" & intangible_sal == 2, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((c) Highest Intangible Salience, size(medium)) 


*********************************************************************
/* Figure 4: Marginal Effects of Dyadic Trade on MID Fatality      */ 
/* Varying Resource Salience and Intangible Salience (Computation) */

use "Main_DATA.dta", replace

*** Model 6 Marginal Effects ***
mi estimate, cmdok post: tobit maxfatal l.tradetie l.resource_sal l.tradetie_rsal l.intangible_sal l.tradetie_intsal l.tradetie_rsal_intsal l.recfat15 l.lncapability l.conttype l.lndist l.disregime l.jointio riveriss mariss, ll(0) ul(6) vce(robust)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)2) l.intangible_sal = 0 riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)2) l.intangible_sal = 3.100463 riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)2) l.intangible_sal = 6 riveriss = 0 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)7) l.intangible_sal = 1 riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)7) l.intangible_sal = 1.965924 riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)7) l.intangible_sal = 2 riveriss = 1 mariss = 0) atmeans level(90) cmdmargins cformat(%9.3f)

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)8) l.intangible_sal = 0 riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f) 

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)8) l.intangible_sal = 1.361748 riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f) 

mimrgns, expression(_b[l.tradetie] + _b[l.tradetie_rsal] *l.resource_sal + _b[l.tradetie_intsal] * l.intangible_sal + _b[l.tradetie_rsal_intsal] * l.resource_sal * l.intangible_sal) at(l.resource_sal = (0(1)8) l.intangible_sal = 2 riveriss = 0 mariss = 1) atmeans level(90) cmdmargins cformat(%9.3f) 


******************************************************************
/* Figure 4: Marginal Effects of Dyadic Trade on MID Fatality   */ 
/* Varying Resource Salience and Intangible Salience (Graphing) */

use "Graphing_DATA.dta", replace

*** Territorial Issues ***	 
twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "terriss" & intangible_sal == 0, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "terriss" & intangible_sal == 0, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((a) Lowest Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "terriss" & intangible_sal == 3.100463, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "terriss" & intangible_sal == 3.100463, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((b) Average Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "terriss" & intangible_sal == 6, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "terriss" & intangible_sal == 6, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((c) Highest Intangible Salience, size(medium)) 

*** River Issues ***
twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "riveriss" & intangible_sal == 1, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "riveriss" & intangible_sal == 1, lcolor(gs6)lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((a) Lowest Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "riveriss" & intangible_sal == 1.965924, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "riveriss" & intangible_sal == 1.965924, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((b) Average Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "riveriss" & intangible_sal == 2, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "riveriss" & intangible_sal == 2, lcolor(gs6)lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") xlabel(0(2)7) title((c) Highest Intangible Salience, size(medium)) 

*** Maritime Issues ***
twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "mariss" & intangible_sal == 0, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "mariss" & intangible_sal == 0, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((a) Lowest Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "mariss" & intangible_sal == 1.361748, color(gs14)lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "mariss" & intangible_sal == 1.361748, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((b) Average Intangible Salience, size(medium)) 

twoway rarea l90 u90 resource_sal if model == 6 & issue_type == "mariss" & intangible_sal == 2, color(gs14) lwidth(none) || line dydx resource_sal if model == 6 & issue_type == "mariss" & intangible_sal == 2, lcolor(gs6) lpattern(solid) graphregion(color(white)) plotregion(color(white)) bgcolor(white) legend(off) ytitle("Marginal Effects of Dyadic Trade") xtitle("Resource Salience") title((c) Highest Intangible Salience, size(medium)) 





 